package com.elm.user.mapper;


import com.elm.user.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user where userId=#{userId} and password=#{password}")
    User getUserByIdByPass(User user);

    @Select("select * from user where userId=#{userId}")
    List<User> getUserById(String userId);

    @Update("update user set userName=#{userName},userSex=#{userSex} where userId=#{userId}")
    int updateUser(User user);

    @Insert("insert into user(userId,password,userName,userSex) values (#{userId},#{password},#{userName},#{userSex})")
    void register(User user);

    @Select("select * from user where userId=#{userId}")
    User getInfo(String userId);
}
